package orbito.scene;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class SceneStore {
	Map<String, SceneGraph> scenes;
	SceneGraph defaultScene;
	
	public SceneStore() {
		scenes = new HashMap<String, SceneGraph>();
		initScenes();
	}
	
	public void addScene(String name, SceneGraph scene) {
		scenes.put(name, scene);
	}
	
	public SceneGraph getScene(String name) {
		if (scenes.containsKey(name)) {
			return scenes.get(name);
		} else {
			return defaultScene;
		}
	}
	
	public Collection<SceneGraph> getAllScenes() {
		return scenes.values();
	}
	
	public void removeScene(String name) {
		scenes.remove(name);
	}
	
	private void initScenes() {
		SceneGraph scene;
		
		// -------------------------------------------
		// The Default Scene.
		
		scene = defaultScene = new SolScene();
		this.addScene(scene.getSceneName(), scene);
		
		// -------------------------------------------
		// Other Scenes.
		
		scene = new RandomSystemScene();
		this.addScene(scene.getSceneName(), scene);
		
		scene = new BasicOrbitsScene();
		this.addScene(scene.getSceneName(), scene);
		
		scene = new EllipticOrbitsScene();
		this.addScene(scene.getSceneName(), scene);
	}
}
